package com.kornero.oms.moscow;

import javax.annotation.concurrent.Immutable;

@Immutable
public class Hospital {

    private final String name;
    private final String address;
    private final String lat;
    private final String lng;

    public Hospital(final String name, final String address, final String lat, final String lng) {
        this.name = name;
        this.address = address;
        this.lat = lat;
        this.lng = lng;
    }

    public String getName() {
        return name;
    }

    public String getAddress() {
        return address;
    }

    public String getLat() {
        return lat;
    }

    public String getLng() {
        return lng;
    }

    public String toJSON() {
        return "{\n" +
                "'name':'" + name + "',\n" +
                "'address':'" + address + "',\n" +
                "'lat':'" + lat + "',\n" +
                "'lng':'" + lng + "'\n" +
                "}";
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) return true;
        if (!(o instanceof Hospital)) return false;

        final Hospital hospital = (Hospital) o;

        if (address != null ? !address.equals(hospital.address) : hospital.address != null) return false;
        if (lat != null ? !lat.equals(hospital.lat) : hospital.lat != null) return false;
        if (lng != null ? !lng.equals(hospital.lng) : hospital.lng != null) return false;
        if (name != null ? !name.equals(hospital.name) : hospital.name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (address != null ? address.hashCode() : 0);
        result = 31 * result + (lat != null ? lat.hashCode() : 0);
        result = 31 * result + (lng != null ? lng.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Hospital{" +
                "name='" + name + '\'' +
                ", address='" + address + '\'' +
                ", lat='" + lat + '\'' +
                ", lng='" + lng + '\'' +
                '}';
    }
}